<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml"
	xmlns:h="http://java.sun.com/jsf/html"
	xmlns:f="http://java.sun.com/jsf/core"
	xmlns:p="http://primefaces.org/ui"
	xmlns:ui="http://java.sun.com/jsf/facelets">

<h:head></h:head>

	<h:body>
        
        <div id="logoHomePage" align="left">
			<a href="..\homepage.xhtml"><img src="grafica\TravelDream_Logo.gif" width="150" height="75"/></a>
		</div>
		
		<div id="logout" align="right">
        	<h:form>
        		<a href="users\index.xhtml">Pagina Personale</a>
        		<h:commandButton action="#{logoutBean.logout}" value="Logout" />	
			</h:form>
		</div>
		
		<h:form>
		<p:panel header="Ricerca Pacchetto">
			<h:panelGrid columns="3" id="findGrid">
				
				<h:outputLabel for="aeroportoPartenza">Aeroporto di partenza:</h:outputLabel>
				<p:inputText id="aeroportoPartenza" value="#{findBean.find.aeroportoPartenza}" />
				<p:message for="aeroportoPartenza" />

				<h:outputLabel for="aeroportoArrivo">Destinazione:</h:outputLabel>
				<p:inputText id="aeroportoArrivo" value="#{findBean.find.aeroportoArrivo}" />
				<p:message for="aeroportoArrivo" />
				
				<p:dataTable value="#{findBean.find.result}" var="result">  		        			
		        	<p:column headerText="Nome Pacchetto"> 
		       			#{result.nome}  
		        	</p:column>
		        	<p:column headerText="Descrizione"> 
		       			#{result.descrizione}  
		        	</p:column>
		        	<p:column headerText="Aeroporto Partenza"> 
		       			#{result.volo.aeroportoPartenza}  
		        	</p:column>
		        	<p:column headerText="Aeroporto Arrivo"> 
		       			#{result.volo.aeroportoArrivo}  
		        	</p:column>
		        	<p:column headerText="Data Partenza"> 
		       			<h:outputText value="#{result.volo.dataPartenza}" >
						<f:convertDateTime pattern="dd/MM/yy hh:mm"/>
						</h:outputText>  
		        	</p:column>
		        	<p:column headerText="Data Ritorno"> 
						<h:outputText value="#{result.volo.dataRitorno}" >
						<f:convertDateTime pattern="dd/MM/yy hh:mm"/>
						</h:outputText>	       		
					</p:column>
		        	<p:column headerText="Compagnia"> 
		       			#{result.volo.compagnia}  
		        	</p:column>
		        	<p:column headerText="Albergo"> 
		       			#{result.albergo.nome}  
		        	</p:column>
		        	<p:column headerText="Stelle"> 
		       			#{result.albergo.stelle}  
		        	</p:column>
		        	<p:column headerText="Stelle"> 
		       			#{result.prezzo}  
		        	</p:column>
		        	<p:column headerText="Acquista">
						<p:inputText id="posti" value="#{acquistoBean.nuovoAcquisto.numPosti}" />
		       			<p:commandButton value="Acquista" action="#{acquistoBean.acquista(result.idPacchetto)}" />
		        	</p:column>
		   		</p:dataTable>
				
			</h:panelGrid>
			<p:commandButton value="Cerca" update="findGrid"
				action="#{findBean.findVolo()}" />

		</p:panel>
	</h:form>
    </h:body>

</html>
